package my_window

import (
    "fmt"
    "github.com/mattn/go-gtk/glib"
    "github.com/mattn/go-gtk/gtk"
)
// Hello returns a greeting for the named person.
func ShowWindow(){
    window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
    window.SetPosition(gtk.WIN_POS_CENTER)
    window.SetTitle("GTK Go!")
    window.SetIconName("gtk-dialog-info")
    window.Connect("destroy", func(ctx *glib.CallbackContext) {
        fmt.Println("got destroy!", ctx.Data().(string))
        gtk.MainQuit()
    }, "foo")

    //--------------------------------------------------------
    // GtkVBox
    vbox := gtk.NewVBox(false, 2)

    //--------------------------------------------------------
    // button
    button := gtk.NewButtonWithLabel("Button with label")
    button.Clicked(func() {
        fmt.Println("button clicked:", button.GetLabel())
    })
    vbox.Add(button)

    //--------------------------------------------------------
    window.Add(vbox)
    window.SetSizeRequest(600, 600)
    window.ShowAll()
}